﻿using Microsoft.Win32;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace UI.WPF.ModernTest
{
  /// <summary>
  /// Interaction logic for MainWindow.xaml
  /// </summary>
  public partial class MainWindow : Window
  {
    public MainWindow()
    {
      InitializeComponent();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
      MessageBox.Show("click");
    }

    private void HandleCheck(object sender, RoutedEventArgs e)
    {
      text1.Text = "The CheckBox is checked.";
    }

    private void HandleUnchecked(object sender, RoutedEventArgs e)
    {
      text1.Text = "The CheckBox is unchecked.";
    }

    private void HandleThirdState(object sender, RoutedEventArgs e)
    {
      text1.Text = "The CheckBox is in the indeterminate state.";
    }

    //private void Button_SaveScreenshot_Click(object sender, RoutedEventArgs e)
    //{
    //  RenderTargetBitmap targetBitmap = new RenderTargetBitmap(
    //      (int)Viewbox_Viewport.ActualWidth,
    //      (int)Viewbox_Viewport.ActualHeight,
    //      96d,
    //      96d,
    //      PixelFormats.Default);

    //  targetBitmap.Render(Viewbox_Viewport);


    //  if (saveFileDialog.ShowDialog() == true)
    //  {
    //    BmpBitmapEncoder encoder = new BmpBitmapEncoder();
    //    encoder.Frames.Add(BitmapFrame.Create(targetBitmap));
    //    // save file to disk
    //    using (FileStream fs = File.Open(saveFileDialog.FileName, FileMode.OpenOrCreate))
    //    {
    //      encoder.Save(fs);
    //    }
    //  }
    //}

    private void MenuItem_Click(object sender, RoutedEventArgs e)
    {
      var btn = (MenuItem)sender;
      switch (btn.Tag)
      {
        case "left":
          TextBox_Text.HorizontalContentAlignment = HorizontalAlignment.Left;

          break;
        case "center":
          TextBox_Text.HorizontalContentAlignment = HorizontalAlignment.Center;
          break; 
        case "right":
          TextBox_Text.HorizontalContentAlignment = HorizontalAlignment.Right;

          break;
      }
    }

    private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
    {
      Process.Start(new ProcessStartInfo("https://inkore.net/")
      {
        UseShellExecute = true
      });
    }
  }
}